package cn.tedu.spring.security.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class PasswordEncoderConfig {

    @Bean
    public PasswordEncoder passwordEncoder(){
        //创建密码编码器 createDelegatingPasswordEncoder会自动选择Spring中推荐的密码加密规则
        PasswordEncoder passwordEncoder= PasswordEncoderFactories
            .createDelegatingPasswordEncoder();
        System.out.println(passwordEncoder.getClass().getName());
        return passwordEncoder;
    }
}
